import http from '@/http/index';
import type {Floor, FloorParams, ResponseData} from '@/types/interface';

const floorApi = {
    // 发布楼层
    publishFloor: (data: FloorParams): Promise<ResponseData<{ floorId: number }>> => {
        return http.post('/floor/publish', data);
    },

    // 获取帖子下的楼层列表
    getPostFloors: (postId: number, page: number, size: number): Promise<ResponseData<{
        list: Floor[];
        total: number;
    }>> => {
        return http.get(`/floor/list?postId=${postId}&page=${page}&size=${size}`);
    },

    // 删除楼层
    deleteFloor: (floorId: number): Promise<ResponseData<boolean>> => {
        return http.delete(`/floor/delete?floorId=${floorId}`);
    }
};

export default floorApi;